1 //==============================================================================
2 // file : XParameters.java
3 // project: Java Common Utility
4 //
5 // last change: date: $Date: 2003/09/10 09:22:14 $
6 // by: $Author: bitiboy $
7 // revision: $Revision: 1.1 $
8 //------------------------------------------------------------------------------
9 // copyright: GNU GPL Software License (see class documentation)
10 //==============================================================================
11 package com.justhis.util;
12
13
14 /*
15 * $Id: XParameters.java,v 1.1 2003/09/10 09:22:14 bitiboy Exp $
16 *
17 * Copyright 2003 Acai Software All Rights Reserved.
18 *
19 * This file XParamters.java is part of the Java Common Utility.
20
21 * The Java Common Utility is free software; you can redistribute it and/or modify
22 * it under the terms of the GNU General Public License as published by
23 * the Free Software Foundation; either version 2 of the License, or
24 * (at your option) any later version.
25
26 * Java Common Utility is distributed in the hope that it will be useful,
27 * but WITHOUT ANY WARRANTY; without even the implied warranty of
28 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29 * GNU General Public License for more details.
30
31 * You should have received a copy of the GNU General Public License
32 * along with the Java Common Utility; if not, write to the Free Software
33 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
34
35 * http://www.justhis.com
36 * CONTACT: email = superaxis@sohu.com webmaster@justhis.com
37 */
38 import java.util.Properties;
39
40
41 /***
42 * TODO
43 *
44 * @author <a href="http://blog.ejb.cn">acai</a>
45 * @version $Revision: 1.1 $
46 */
47 public class XParameters extends Properties {
48 //~ Methods ----------------------------------------------------------------
49
50 /***
51 * TODO DOCUMENT ME!
52 *
53 * @param string TODO
54 *
55 * @return TODO
56 */
57 public boolean getBooleanProperty(String string) {
58 boolean sign = false;
59
60 try {
61 sign = Boolean.valueOf(getProperty(string)).booleanValue();
62 } catch (Exception e) {
63 }
64
65 return sign;
66 }
67
68 /***
69 * TODO
70 *
71 * @param pro TODO
72 *
73 * @return TODO
74 */
75 public int getIntProperty(String pro) {
76 if (pro == null) {
77 return -1;
78 }
79
80 int m = -1;
81
82 try {
83 m = Integer.parseInt(this.getProperty(pro));
84 } catch (Exception e) {
85 }
86
87 return m;
88 }
89
90 /***
91 * TODO DOCUMENT ME!
92 *
93 * @param pro TODO
94 *
95 * @return TODO
96 */
97 public long getLongProperty(String pro) {
98 if (pro == null) {
99 return -1;
100 }
101
102 long m = -1;
103
104 try {
105 m = Long.parseLong(this.getProperty(pro));
106 } catch (Exception e) {
107 }
108
109 return m;
110 }
111
112 /***
113 * TODO
114 *
115 * @param key TODO
116 * @param value TODO
117 *
118 * @return TODO
119 */
120 public synchronized Object setProperty(String key, String value) {
121 if (value == null) {
122 return null;
123 }
124
125 return put(key, value);
126 }
127
128 /***
129 * TODO
130 *
131 * @param key TODO
132 *
133 * @return TODO
134 */
135 public String getProperty(String key) {
136 String value = super.getProperty(key);
137
138 if ((value != null) && (value.trim().length() == 0)) {
139 value = null;
140 }
141
142 return value;
143 }
144 }
145
146
147 /*
148 * $Log: XParameters.java,v $
149 * Revision 1.1 2003/09/10 09:22:14 bitiboy
150 * *** empty log message ***
151 *
152 *
153 */
This page was automatically generated by Maven